<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>智能课表查询系统</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        // 配置Tailwind自定义主题
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#165DFF',
                        secondary: '#36CFC9',
                        accent: '#722ED1',
                        neutral: '#F5F7FA',
                        dark: '#1D2129'
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    },
                    boxShadow: {
                        'card': '0 4px 12px rgba(22, 93, 255, 0.08)',
                        'hover': '0 8px 20px rgba(22, 93, 255, 0.12)',
                    }
                },
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .card-transition {
                transition: all 0.3s ease;
            }
            .text-gradient {
                background-clip: text;
                -webkit-background-clip: text;
                color: transparent;
                background-image: linear-gradient(135deg, #165DFF, #722ED1);
            }
            .bg-blur {
                backdrop-filter: blur(8px);
                -webkit-backdrop-filter: blur(8px);
            }
            .class-card-active {
                border-left: 4px solid #165DFF;
            }
            .class-card-upcoming {
                border-left: 4px solid #36CFC9;
            }
        }
    </style>
</head>
<body class="bg-neutral min-h-screen font-sans text-dark overflow-x-hidden">
    <!-- 顶部导航栏 -->
    <header class="sticky top-0 z-50 bg-white/90 bg-blur border-b border-gray-200 shadow-sm">
        <div class="container mx-auto px-4 py-3 flex flex-wrap justify-between items-center gap-2">
            <div class="flex items-center gap-2">
                <i class="fa fa-graduation-cap text-primary text-2xl"></i>
                <h1 class="text-xl md:text-2xl font-bold text-gradient">智能课表查询系统（25数媒精英1班）</h1>
            </div>
            <div class="flex items-center gap-4">
                <span id="current-time" class="text-sm md:text-base font-medium text-gray-600 whitespace-nowrap"></span>
                <span id="current-date" class="text-sm md:text-base font-medium text-gray-600 whitespace-nowrap"></span>
            </div>
        </div>
    </header>

    <main class="container mx-auto px-4 py-6 md:py-8">
        <!-- 当前课程和下一节课小卡片 -->
        <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6 md:mb-8">
            <!-- 当前课程卡片 -->
            <section id="current-class" class="col-span-1">
                <div class="bg-white rounded-2xl shadow-card p-5 md:p-6 card-transition hover:shadow-hover h-full">
                    <div class="flex justify-between items-center mb-4">
                        <h2 class="text-xl font-bold text-primary flex items-center gap-2">
                            <i class="fa fa-clock-o"></i>当前课程
                        </h2>
                        <span id="current-class-status" class="px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-600">
                            正在上课
                        </span>
                    </div>
                    <div id="current-class-content" class="w-full">
                        <!-- 当前课程内容将通过JS动态填充 -->
                        <div class="text-center py-6 text-gray-500">
                            <i class="fa fa-calendar-o text-4xl mb-3"></i>
                            <p>当前无正在进行的课程</p>
                        </div>
                    </div>
                </div>
            </section>

            <!-- 下一节课卡片 -->
            <section id="next-class" class="col-span-1">
                <div class="bg-white rounded-2xl shadow-card p-5 md:p-6 card-transition hover:shadow-hover h-full">
                    <div class="flex justify-between items-center mb-4">
                        <h2 class="text-xl font-bold text-secondary flex items-center gap-2">
                            <i class="fa fa-bell-o"></i>下一节课
                        </h2>
                        <span id="next-class-countdown" class="px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-600">
                            30分钟后开始
                        </span>
                    </div>
                    <div id="next-class-content" class="w-full">
                        <!-- 下一节课内容将通过JS动态填充 -->
                        <div class="text-center py-6 text-gray-500">
                            <i class="fa fa-calendar-check-o text-4xl mb-3"></i>
                            <p>暂无后续课程安排</p>
                        </div>
                    </div>
                </div>
            </section>
        </div>

        <!-- 今日课程与未来七天课程 -->
        <div class="mb-6 md:mb-8">
            <section id="upcoming-7days">
                <div class="bg-white rounded-2xl shadow-card p-5 md:p-6 card-transition hover:shadow-hover">
                    <h2 class="text-xl font-bold text-accent flex items-center gap-2 mb-6">
                        <i class="fa fa-calendar"></i>未来七天课程
                    </h2>
                    
                    <!-- 日期导航标签 -->
                    <div class="flex overflow-x-auto pb-2 mb-6 gap-2 md:gap-4 scrollbar-hide">
                        <button id="day-0-tab" class="px-4 py-2 bg-primary text-white rounded-lg whitespace-nowrap font-medium">
                            今天
                        </button>
                        <button id="day-1-tab" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg whitespace-nowrap font-medium hover:bg-gray-200 transition-colors">
                            明天
                        </button>
                        <button id="day-2-tab" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg whitespace-nowrap font-medium hover:bg-gray-200 transition-colors">
                            后天
                        </button>
                        <button id="day-3-tab" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg whitespace-nowrap font-medium hover:bg-gray-200 transition-colors">
                            第4天
                        </button>
                        <button id="day-4-tab" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg whitespace-nowrap font-medium hover:bg-gray-200 transition-colors">
                            第5天
                        </button>
                        <button id="day-5-tab" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg whitespace-nowrap font-medium hover:bg-gray-200 transition-colors">
                            第6天
                        </button>
                        <button id="day-6-tab" class="px-4 py-2 bg-gray-100 text-gray-700 rounded-lg whitespace-nowrap font-medium hover:bg-gray-200 transition-colors">
                            第7天
                        </button>
                    </div>
                    
                    <!-- 日期内容区域 -->
                    <div id="upcoming-7days-content">
                        <!-- 未来七天课程内容将通过JS动态填充 -->
                        <div id="day-0-content" class="day-content block">
                            <!-- 今日课程将在这里显示 -->
                        </div>
                        <div id="day-1-content" class="day-content hidden">
                            <!-- 明日课程将在这里显示 -->
                        </div>
                        <div id="day-2-content" class="day-content hidden">
                            <!-- 后天课程将在这里显示 -->
                        </div>
                        <div id="day-3-content" class="day-content hidden">
                            <!-- 第4天课程将在这里显示 -->
                        </div>
                        <div id="day-4-content" class="day-content hidden">
                            <!-- 第5天课程将在这里显示 -->
                        </div>
                        <div id="day-5-content" class="day-content hidden">
                            <!-- 第6天课程将在这里显示 -->
                        </div>
                        <div id="day-6-content" class="day-content hidden">
                            <!-- 第7天课程将在这里显示 -->
                        </div>
                    </div>
                </div>
            </section>
        </div>

        <!-- 周检索功能 -->
        <section id="week-search" class="mb-6 md:mb-8">
            <div class="bg-white rounded-2xl shadow-card p-5 md:p-6 card-transition hover:shadow-hover">
                <h2 class="text-xl font-bold text-primary flex items-center gap-2 mb-5">
                    <i class="fa fa-search"></i>课程检索
                </h2>
                <div class="flex flex-col md:flex-row gap-3 md:gap-4 mb-5">
                    <div class="flex-1">
                        <label for="search-week" class="block text-sm font-medium text-gray-700 mb-1">选择周</label>
                        <select id="search-week" class="w-full px-4 py-3 rounded-lg border border-gray-200 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all">
                            <!-- 周选项将通过JS动态填充 -->
                        </select>
                    </div>
                    <button id="search-btn" class="px-5 py-3 bg-primary text-white rounded-lg font-medium flex items-center justify-center gap-2 hover:bg-primary/90 transition-all w-full md:w-auto">
                        <i class="fa fa-search"></i>查询课程
                    </button>
                </div>
                <div id="search-result" class="mt-5">
                    <div class="text-center py-8 text-gray-500">
                        <i class="fa fa-calendar-search-o text-3xl mb-2"></i>
                        <p>请选择周并点击查询按钮</p>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <footer class="bg-white border-t border-gray-200 py-5">
        <div class="container mx-auto px-4 text-center text-gray-500 text-sm">
            <p>©2025 25级数媒技术（精英）1班</p>
            <p>Copyright@林国锂</p>
            <p class="mt-2">数据来源：25级数媒技术（精英）1班课表 2025年9月22日</p>
        </div>
    </footer>

    <script>
        // 完整学期课程数据（根据图片内容整理）
        const courseData = [
            // 第4周（9月22日-9月28日）课程
            {week: 4, date: '2025-09-24', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 4, date: '2025-09-25', day: '四', time: '10:10-11:50', section: '3-4节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 4, date: '2025-09-25', day: '四', time: '16:05-17:45', section: '7-8节', name: '形势与政策', credit: '1.0学分', location: '1409多媒体教室', teacher: '陈秋怡'},
            {week: 4, date: '2025-09-26', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '操场', teacher: '刘宽'},

            // 第5周课程（9月29日-10月5日）
            {week: 5, date: '2025-10-1', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 5, date: '2025-10-3', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},

             // 第6周课程（10月6日-10月12日）
            {week: 6, date: '2025-10-7', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 6, date: '2025-10-7', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 6, date: '2025-10-7', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 6, date: '2025-10-8', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 6, date: '2025-10-9', day: '四', time: '10:10-11:50', section: '3-4节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 6, date: '2025-10-9', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 6, date: '2025-10-9', day: '四', time: '16:05-17:45', section: '7-8节', name: '形势与政策', credit: '1.0学分', location: '1409多媒体教室', teacher: '陈秋怡'},
            {week: 6, date: '2025-10-10', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
             // 第7周课程（10月13日-10月19日）
            {week: 7, date: '2025-10-13', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 7, date: '2025-10-14', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 7, date: '2025-10-14', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '2学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 7, date: '2025-10-14', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 7, date: '2025-10-15', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 7, date: '2025-10-15', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 7, date: '2025-10-16', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 7, date: '2025-10-17', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 7, date: '2025-10-17', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 7, date: '2025-10-17', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
             // 第8周课程（10月20日-10月26日）
            {week: 8, date: '2025-10-20', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 8, date: '2025-10-20', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 8, date: '2025-10-21', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 8, date: '2025-10-21', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '2学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 8, date: '2025-10-21', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 8, date: '2025-10-22', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 8, date: '2025-10-22', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 8, date: '2025-10-23', day: '四', time: '10:10-11:50', section: '3-4节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 8, date: '2025-10-23', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 8, date: '2025-10-24', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 8, date: '2025-10-24', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 8, date: '2025-10-24', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第9周课程（10月27日-11月2日）
            {week: 9, date: '2025-10-27', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 9, date: '2025-10-27', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 9, date: '2025-10-28', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 9, date: '2025-10-28', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 9, date: '2025-10-28', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 9, date: '2025-10-29', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 9, date: '2025-10-29', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 9, date: '2025-10-30', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 9, date: '2025-10-31', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 9, date: '2025-10-31', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 9, date: '2025-10-31', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第10周课程（11月3日-11月9日）
            {week: 10, date: '2025-11-3', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 10, date: '2025-11-3', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 10, date: '2025-11-4', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 10, date: '2025-11-4', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 10, date: '2025-11-4', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 10, date: '2025-11-5', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 10, date: '2025-11-5', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 10, date: '2025-11-6', day: '四', time: '10:10-11:50', section: '3-4节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 10, date: '2025-11-6', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 10, date: '2025-11-7', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 10, date: '2025-11-7', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 10, date: '2025-11-7', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第11周课程（11月10日-11月16日）
            {week: 11, date: '2025-11-10', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 11, date: '2025-11-10', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 11, date: '2025-11-11', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 11, date: '2025-11-11', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 11, date: '2025-11-11', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 11, date: '2025-11-12', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 11, date: '2025-11-12', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 11, date: '2025-11-13', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 11, date: '2025-11-14', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 11, date: '2025-11-14', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 11, date: '2025-11-14', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
             // 第12周课程（11月17日-11月23日）
            {week: 12, date: '2025-11-17', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 12, date: '2025-11-17', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 12, date: '2025-11-18', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 12, date: '2025-11-18', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 12, date: '2025-11-18', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 12, date: '2025-11-19', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 12, date: '2025-11-19', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 12, date: '2025-11-20', day: '四', time: '10:10-11:50', section: '3-4节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 12, date: '2025-11-20', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 12, date: '2025-11-21', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 12, date: '2025-11-21', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 12, date: '2025-11-21', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第13周课程（11月24日-11月30日）
            {week: 13, date: '2025-11-24', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 13, date: '2025-11-24', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 13, date: '2025-11-25', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 13, date: '2025-11-25', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 13, date: '2025-11-25', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 13, date: '2025-11-26', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 13, date: '2025-11-26', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 13, date: '2025-11-27', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 13, date: '2025-11-28', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 13, date: '2025-11-28', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 13, date: '2025-11-28', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第14周课程（12月1日-12月7日）
            {week: 14, date: '2025-12-1', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 14, date: '2025-12-1', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 14, date: '2025-12-2', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 14, date: '2025-12-2', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 14, date: '2025-12-2', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 14, date: '2025-12-3', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 14, date: '2025-12-3', day: '三', time: '10:10-11:50', section: '3-4节', name: '军事课', credit: '4学分', location: '3205报告厅', teacher: '吴春花'},
            {week: 14, date: '2025-12-4', day: '四', time: '10:10-11:50', section: '3-4节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 14, date: '2025-12-4', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 14, date: '2025-12-5', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 14, date: '2025-12-5', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 14, date: '2025-12-5', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第15周课程（12月8日-12月14日）
            {week: 15, date: '2025-12-8', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 15, date: '2025-12-8', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 15, date: '2025-12-9', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 15, date: '2025-12-9', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 15, date: '2025-12-9', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 15, date: '2025-12-10', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 15, date: '2025-12-11', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 15, date: '2025-12-12', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 15, date: '2025-12-12', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 15, date: '2025-12-12', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第16周课程（12月15日-12月21日）
            {week: 16, date: '2025-12-15', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 16, date: '2025-12-15', day: '一', time: '16:05-17:45', section: '7-8节', name: '构成设计基础', credit: '2.0学分', location: '1211多媒体教室', teacher: '余睿'},
            {week: 16, date: '2025-12-16', day: '二', time: '08:15-09:55', section: '1-2节', name: '构成设计基础', credit: '2学分', location: '1212多媒体教室', teacher: '余睿'},
            {week: 16, date: '2025-12-16', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 16, date: '2025-12-16', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 16, date: '2025-12-17', day: '三', time: '08:15-09:55', section: '1-2节', name: '思想道德与法治', credit: '3学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 16, date: '2025-12-18', day: '四', time: '10:10-11:50', section: '3-4节', name: '思想道德与法治', credit: '3.0学分', location: '1216多媒体教室', teacher: '尹秀娟'},
            {week: 16, date: '2025-12-18', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 16, date: '2025-12-19', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 16, date: '2025-12-19', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 16, date: '2025-12-19', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第17周课程（12月22日-12月28日）
            {week: 17, date: '2025-12-22', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 17, date: '2025-12-23', day: '二', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 17, date: '2025-12-23', day: '二', time: '16:05-17:45', section: '7-8节', name: '信息技术', credit: '3.0学分', location: '10204机房', teacher: '吴晓婷'},
            {week: 17, date: '2025-12-25', day: '四', time: '14:10-15:50', section: '5-6节', name: '大学英语I', credit: '3学分', location: '2411多媒体教室', teacher: '韩群'},
            {week: 17, date: '2025-12-26', day: '五', time: '08:15-09:55', section: '1-2节', name: '信息技术', credit: '3.0学分', location: '10208机房', teacher: '吴晓婷'},
            {week: 17, date: '2025-12-26', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            {week: 17, date: '2025-12-26', day: '五', time: '14:10-15:50', section: '5-6节', name: '大学体育', credit: '3.5学分', location: '无固定地点', teacher: '刘宽'},
            // 第18周课程（12月29日-1月4日）
            {week: 18, date: '2025-12-29', day: '一', time: '14:10-15:50', section: '5-6节', name: 'Photoshop图像处理', credit: '3学分', location: '1510多媒体教室', teacher: '邓滢'},
            {week: 18, date: '2026-1-2', day: '五', time: '10:10-11:50', section: '3-4节', name: 'Photoshop图像处理', credit: '3学分', location: '10209机房', teacher: '邓滢'},
            // 可以继续添加其他周的课程...
        ];

        // 每周的起始日期映射
        const weekDateRanges = {
            4: "9月22日-9月28日",
            5: "9月29日-10月5日",
            6: "10月6日-10月12日",
            7: "10月13日-10月19日",
            8: "10月20日-10月26日",
            9: "10月27日-11月2日",
            10: "11月3日-11月9日",
            11: "11月10日-11月16日",
            12: "11月17日-11月23日",
            13: "11月24日-11月30日",
            14: "12月1日-12月7日",
            15: "12月8日-12月14日",
            16: "12月15日-12月21日",
            17: "12月22日-12月28日",
            18: "12月29日-1月4日"
        };

        // 上课时间配置
        const classTimeConfig = [
            {section: '1-2节', start: '08:15', end: '09:55'},
            {section: '3-4节', start: '10:10', end: '11:50'},
            {section: '5-6节', start: '14:10', end: '15:50'},
            {section: '7-8节', start: '16:05', end: '17:45'}
        ];

        // 工具函数：格式化日期
        function formatDate(date) {
            const year = date.getFullYear();
            const month = String(date.getMonth() + 1).padStart(2, '0');
            const day = String(date.getDate()).padStart(2, '0');
            return `${year}-${month}-${day}`;
        }

        // 工具函数：获取当前日期的星期
        function getWeekDay(date) {
            const weekDays = ['日', '一', '二', '三', '四', '五', '六'];
            return weekDays[date.getDay()];
        }

        // 工具函数：比较时间
        function compareTime(time1, time2) {
            const t1 = new Date(`2025-01-01 ${time1}`);
            const t2 = new Date(`2025-01-01 ${time2}`);
            return t1 - t2;
        }

        // 工具函数：获取当前时间
        function getCurrentTime() {
            const now = new Date();
            const hours = String(now.getHours()).padStart(2, '0');
            const minutes = String(now.getMinutes()).padStart(2, '0');
            const seconds = String(now.getSeconds()).padStart(2, '0');
            return `${hours}:${minutes}:${seconds}`;
        }

        // 工具函数：计算倒计时（精确到秒）
        function calculateCountdown(targetDate, targetTime) {
            const now = new Date();
            const [targetHours, targetMinutes] = targetTime.split(':').map(Number);
            const [year, month, day] = targetDate.split('-').map(Number);
            
            const target = new Date(year, month - 1, day, targetHours, targetMinutes, 0);
            
            if (target < now) {
                return '课程已开始';
            }
            
            const diff = target - now;
            const days = Math.floor(diff / (1000 * 60 * 60 * 24));
            const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
            const seconds = Math.floor((diff % (1000 * 60)) / 1000);
            
            let result = '';
            if (days > 0) result += `${days}天`;
            if (hours > 0) result += `${hours}时`;
            if (minutes > 0) result += `${minutes}分`;
            result += `${seconds}秒`;
            
            return result + '后开始';
        }

        // 获取当前课程
        function getCurrentClass() {
            const now = new Date();
            const currentDate = formatDate(now);
            const currentTimeStr = getCurrentTime().substring(0, 5); // 只取时分
            
            // 筛选当天课程
            const todayCourses = courseData.filter(course => course.date === currentDate);
            
            if (todayCourses.length === 0) {
                return null;
            }
            
            // 检查是否有正在进行的课程
            for (const course of todayCourses) {
                const timeConfig = classTimeConfig.find(config => config.section === course.section);
                if (!timeConfig) continue;
                
                const isAfterStart = compareTime(currentTimeStr, timeConfig.start) >= 0;
                const isBeforeEnd = compareTime(currentTimeStr, timeConfig.end) <= 0;
                
                if (isAfterStart && isBeforeEnd) {
                    // 计算剩余时间
                    const endTime = new Date(`${currentDate} ${timeConfig.end}`);
                    const nowTime = new Date();
                    const remainingMs = endTime - nowTime;
                    
                    const remainingMinutes = Math.floor(remainingMs / (1000 * 60));
                    const remainingSeconds = Math.floor((remainingMs % (1000 * 60)) / 1000);
                    
                    const remainingTime = `${remainingMinutes}分${remainingSeconds}秒`;
                    
                    return { ...course, ...timeConfig, remainingTime };
                }
            }
            
            return null;
        }

        // 获取下一节课（最近的一节课，不限制在今天）
        function getNextClass() {
            const now = new Date();
            const currentDate = formatDate(now);
            const currentTimeStr = getCurrentTime().substring(0, 5); // 只取时分
            
            // 复制并排序所有课程，找到最近的一节课
            const allCourses = [...courseData];
            
            // 为每个课程添加时间戳用于排序
            allCourses.forEach(course => {
                const timeConfig = classTimeConfig.find(config => config.section === course.section) || {};
                const [year, month, day] = course.date.split('-').map(Number);
                const [hours, minutes] = timeConfig.start ? timeConfig.start.split(':').map(Number) : [23, 59];
                
                // 创建时间戳
                course.timestamp = new Date(year, month - 1, day, hours, minutes).getTime();
                course.timeConfig = timeConfig;
            });
            
            // 筛选出未来的课程
            const futureCourses = allCourses.filter(course => {
                // 课程日期在今天之后
                if (course.date > currentDate) {
                    return true;
                }
                // 课程日期是今天，但时间在当前时间之后
                else if (course.date === currentDate && course.timeConfig.start) {
                    return compareTime(currentTimeStr, course.timeConfig.start) < 0;
                }
                return false;
            });
            
            // 按时间戳排序，找到最近的课程
            if (futureCourses.length > 0) {
                futureCourses.sort((a, b) => a.timestamp - b.timestamp);
                return { ...futureCourses[0], ...futureCourses[0].timeConfig };
            }
            
            return null;
        }

        // 获取指定天数后的课程（0=今天，1=明天，...，6=第7天）
        function getCoursesByDayOffset(offset) {
            const now = new Date();
            now.setDate(now.getDate() + offset);
            const targetDate = formatDate(now);
            
            // 筛选指定日期课程并排序
            const courses = courseData.filter(course => course.date === targetDate);
            courses.sort((a, b) => {
                const aTime = classTimeConfig.find(c => c.section === a.section)?.start || '23:59';
                const bTime = classTimeConfig.find(c => c.section === b.section)?.start || '23:59';
                return compareTime(aTime, bTime);
            });
            
            return {
                date: targetDate,
                weekDay: getWeekDay(now),
                courses: courses
            };
        }

        // 获取指定周的课程
        function getCoursesByWeek(weekNumber) {
            // 筛选指定周的课程
            const courses = courseData.filter(course => course.week === weekNumber);
            
            // 按日期和时间排序
            courses.sort((a, b) => {
                // 先按日期排序
                if (a.date !== b.date) {
                    return new Date(a.date) - new Date(b.date);
                }
                
                // 再按时间排序
                const aTime = classTimeConfig.find(c => c.section === a.section)?.start || '23:59';
                const bTime = classTimeConfig.find(c => c.section === b.section)?.start || '23:59';
                return compareTime(aTime, bTime);
            });
            
            return courses;
        }

        // 获取所有周数（第4到第18周）
        function getAllWeeks() {
            const weeks = [];
            for (let i = 4; i <= 18; i++) {
                weeks.push(i);
            }
            return weeks;
        }

        // 获取当前周（根据当前日期计算所在的教学周）
        function getCurrentWeek() {
            // 学期开始日期：第4周开始于2025-09-22
            const termStart = new Date(2025, 8, 22); // 月份从0开始，9月是8
            const now = new Date();
            
            // 计算与学期开始日期的天数差
            const diffTime = Math.abs(now - termStart);
            const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
            
            // 计算当前周数（每7天为一周）
            let currentWeek = 4 + Math.floor(diffDays / 7);
            
            // 确保周数在4-18范围内
            if (currentWeek < 4) currentWeek = 4;
            if (currentWeek > 18) currentWeek = 18;
            
            return currentWeek;
        }

        // 渲染当前课程
        function renderCurrentClass() {
            const currentClass = getCurrentClass();
            const contentEl = document.getElementById('current-class-content');
            const statusEl = document.getElementById('current-class-status');
            
            if (currentClass) {
                statusEl.className = 'px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-600';
                statusEl.textContent = `剩余 ${currentClass.remainingTime}`;
                
                contentEl.innerHTML = `
                    <div>
                        <h3 class="text-lg font-bold text-primary mb-3">${currentClass.name}</h3>
                        <div class="space-y-2 text-sm">
                            <p class="flex items-center text-gray-600"><i class="fa fa-calendar w-5 text-gray-400 mr-2"></i>${currentClass.date}（周${currentClass.day}） ${currentClass.section}</p>
                            <p class="flex items-center text-gray-600"><i class="fa fa-clock-o w-5 text-gray-400 mr-2"></i>${currentClass.start}-${currentClass.end}</p>
                            <p class="flex items-center text-gray-600"><i class="fa fa-map-marker w-5 text-gray-400 mr-2"></i>${currentClass.location}</p>
                            <p class="flex items-center text-gray-600"><i class="fa fa-user-o w-5 text-gray-400 mr-2"></i>${currentClass.teacher}</p>
                        </div>
                    </div>
                `;
            } else {
                statusEl.className = 'px-3 py-1 rounded-full text-sm font-medium bg-gray-100 text-gray-600';
                statusEl.textContent = '无课程';
                
                contentEl.innerHTML = `
                    <div class="text-center py-6 text-gray-500">
                        <i class="fa fa-calendar-o text-4xl mb-3"></i>
                        <p>当前无正在进行的课程</p>
                    </div>
                `;
            }
        }

        // 渲染下一节课
        function renderNextClass() {
            const nextClass = getNextClass();
            const contentEl = document.getElementById('next-class-content');
            const countdownEl = document.getElementById('next-class-countdown');
            
            if (nextClass) {
                // 计算倒计时（每秒更新）
                const countdown = calculateCountdown(nextClass.date, nextClass.start);
                countdownEl.className = 'px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-600';
                countdownEl.textContent = countdown;
                
                // 确定是哪天的课程
                const today = formatDate(new Date());
                let dayLabel = '';
                if (nextClass.date === today) {
                    dayLabel = '今天';
                } else {
                    const tomorrow = new Date();
                    tomorrow.setDate(tomorrow.getDate() + 1);
                    if (nextClass.date === formatDate(tomorrow)) {
                        dayLabel = '明天';
                    } else {
                        const nextDate = new Date(nextClass.date);
                        dayLabel = `${nextDate.getMonth() + 1}月${nextDate.getDate()}日（周${nextClass.day}）`;
                    }
                }
                
                contentEl.innerHTML = `
                    <div>
                        <h3 class="text-lg font-bold text-secondary mb-3">${nextClass.name}</h3>
                        <div class="space-y-2 text-sm">
                            <p class="flex items-center text-gray-600"><i class="fa fa-calendar w-5 text-gray-400 mr-2"></i>${dayLabel} ${nextClass.section}</p>
                            <p class="flex items-center text-gray-600"><i class="fa fa-clock-o w-5 text-gray-400 mr-2"></i>${nextClass.start}-${nextClass.end}</p>
                            <p class="flex items-center text-gray-600"><i class="fa fa-map-marker w-5 text-gray-400 mr-2"></i>${nextClass.location}</p>
                            <p class="flex items-center text-gray-600"><i class="fa fa-user-o w-5 text-gray-400 mr-2"></i>${nextClass.teacher}</p>
                        </div>
                    </div>
                `;
            } else {
                countdownEl.className = 'px-3 py-1 rounded-full text-sm font-medium bg-gray-100 text-gray-600';
                countdownEl.textContent = '无课程';
                
                contentEl.innerHTML = `
                    <div class="text-center py-6 text-gray-500">
                        <i class="fa fa-calendar-check-o text-4xl mb-3"></i>
                        <p>暂无后续课程安排</p>
                    </div>
                `;
            }
        }

        // 渲染未来七天课程
        function renderUpcoming7Days() {
            // 渲染7天的课程
            for (let i = 0; i < 7; i++) {
                const dayData = getCoursesByDayOffset(i);
                renderDayContent(`day-${i}-content`, dayData);
                
                // 添加标签切换事件
                document.getElementById(`day-${i}-tab`).addEventListener('click', () => switchDayTab(i));
            }
        }

        // 渲染特定天的课程内容
        function renderDayContent(elementId, dayData) {
            const element = document.getElementById(elementId);
            const { date, weekDay, courses } = dayData;
            
            if (courses.length > 0) {
                let html = `
                    <div class="mb-4">
                        <h3 class="text-base font-medium text-gray-500">${date}（周${weekDay}）</h3>
                        <p class="text-sm text-gray-400">共${courses.length}门课程</p>
                    </div>
                    <div class="space-y-3">
                `;
                
                courses.forEach(course => {
                    const timeConfig = classTimeConfig.find(config => config.section === course.section) || {};
                    const now = new Date();
                    const isToday = formatDate(now) === date;
                    let isPast = false;
                    
                    if (isToday) {
                        const currentTimeStr = getCurrentTime().substring(0, 5);
                        isPast = timeConfig.end && compareTime(currentTimeStr, timeConfig.end) > 0;
                    }
                    
                    html += `
                        <div class="bg-white border border-gray-100 rounded-lg p-4 shadow-sm ${isPast ? 'opacity-70' : ''} ${isToday && !isPast && timeConfig.start && timeConfig.end && 
                            compareTime(getCurrentTime().substring(0,5), timeConfig.start) >= 0 && 
                            compareTime(getCurrentTime().substring(0,5), timeConfig.end) <= 0 ? 'class-card-active' : ''}">
                            <div class="flex justify-between items-start mb-2">
                                <h4 class="font-bold text-base ${isPast ? 'text-gray-500' : 'text-dark'}">${course.name}</h4>
                                <span class="px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-700">
                                    ${course.section}
                                </span>
                            </div>
                            <div class="grid grid-cols-2 gap-2 text-xs text-gray-600">
                                <div class="flex items-center"><i class="fa fa-clock-o w-4 text-gray-400 mr-1"></i>${timeConfig.start || ''}-${timeConfig.end || ''}</div>
                                <div class="flex items-center"><i class="fa fa-map-marker w-4 text-gray-400 mr-1"></i>${course.location}</div>
                                <div class="flex items-center"><i class="fa fa-user-o w-4 text-gray-400 mr-1"></i>${course.teacher}</div>
                                <div class="flex items-center"><i class="fa fa-book w-4 text-gray-400 mr-1"></i>${course.credit}</div>
                            </div>
                        </div>
                    `;
                });
                
                html += `</div>`;
                element.innerHTML = html;
            } else {
                element.innerHTML = `
                    <div class="text-center py-8 text-gray-500">
                        <i class="fa fa-calendar-o text-3xl mb-2"></i>
                        <p>${date}（周${weekDay}）无课程安排</p>
                    </div>
                `;
            }
        }

        // 切换日期标签
        function switchDayTab(dayIndex) {
            // 更新标签样式
            for (let i = 0; i < 7; i++) {
                document.getElementById(`day-${i}-tab`).className = dayIndex === i 
                    ? 'px-4 py-2 bg-primary text-white rounded-lg whitespace-nowrap font-medium'
                    : 'px-4 py-2 bg-gray-100 text-gray-700 rounded-lg whitespace-nowrap font-medium hover:bg-gray-200 transition-colors';
                
                // 显示对应内容
                document.getElementById(`day-${i}-content`).className = dayIndex === i ? 'day-content block' : 'day-content hidden';
            }
        }

        // 渲染周查询结果
        function renderWeekSearchResult(weekNumber) {
            const courses = getCoursesByWeek(weekNumber);
            const resultEl = document.getElementById('search-result');
            const dateRange = weekDateRanges[weekNumber] || '';
            
            if (courses.length > 0) {
                // 按日期分组
                const coursesByDate = {};
                courses.forEach(course => {
                    if (!coursesByDate[course.date]) {
                        coursesByDate[course.date] = [];
                    }
                    coursesByDate[course.date].push(course);
                });
                
                let html = `
                    <div class="mb-6">
                        <h3 class="text-lg font-bold text-primary">第${weekNumber}周课程安排 ${dateRange ? `（${dateRange}）` : ''}</h3>
                        <p class="text-gray-500 text-sm">共${Object.keys(coursesByDate).length}天有课程，总计${courses.length}门课程</p>
                    </div>
                    <div class="space-y-6">
                `;
                
                // 遍历每一天
                Object.keys(coursesByDate).forEach(date => {
                    const dayCourses = coursesByDate[date];
                    const dateObj = new Date(date);
                    const weekDay = getWeekDay(dateObj);
                    
                    html += `
                        <div>
                            <div class="mb-3 flex items-center">
                                <h4 class="font-bold text-base text-dark">${date}（周${weekDay}）</h4>
                                <span class="ml-2 px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-700">
                                    ${dayCourses.length}门课程
                                </span>
                            </div>
                            <div class="space-y-3 pl-2 border-l-2 border-gray-100">
                    `;
                    
                    // 遍历当天课程
                    dayCourses.forEach(course => {
                        const timeConfig = classTimeConfig.find(config => config.section === course.section) || {};
                        
                        html += `
                            <div class="bg-white border border-gray-100 rounded-lg p-4 shadow-sm">
                                <div class="flex justify-between items-start mb-3">
                                    <h5 class="font-bold text-base text-primary">${course.name}</h5>
                                    <span class="px-2 py-0.5 rounded text-xs font-medium bg-primary/10 text-primary">
                                        ${course.section}
                                    </span>
                                </div>
                                <div class="grid grid-cols-2 md:grid-cols-4 gap-2 text-sm text-gray-600">
                                    <div class="flex items-center"><i class="fa fa-clock-o w-4 text-gray-400 mr-1"></i>${timeConfig.start || ''}-${timeConfig.end || ''}</div>
                                    <div class="flex items-center"><i class="fa fa-map-marker w-4 text-gray-400 mr-1"></i>${course.location}</div>
                                    <div class="flex items-center"><i class="fa fa-user-o w-4 text-gray-400 mr-1"></i>${course.teacher}</div>
                                    <div class="flex items-center"><i class="fa fa-book w-4 text-gray-400 mr-1"></i>${course.credit}</div>
                                </div>
                            </div>
                        `;
                    });
                    
                    html += `
                            </div>
                        </div>
                    `;
                });
                
                html += `</div>`;
                resultEl.innerHTML = html;
            } else {
                resultEl.innerHTML = `
                    <div class="text-center py-8 text-gray-500">
                        <i class="fa fa-calendar-o text-3xl mb-2"></i>
                        <p>第${weekNumber}周 ${dateRange ? `（${dateRange}）` : ''} 暂无课程安排</p>
                    </div>
                `;
            }
        }

        // 初始化周选择下拉框
        function initWeekSelector() {
            const weekSelect = document.getElementById('search-week');
            const weeks = getAllWeeks();
            const currentWeek = getCurrentWeek();
            
            // 清空现有选项
            weekSelect.innerHTML = '';
            
            // 添加所有周选项，包含日期范围
            weeks.forEach(week => {
                const option = document.createElement('option');
                option.value = week;
                const dateRange = weekDateRanges[week] || '';
                option.textContent = `第${week}周 ${dateRange ? `（${dateRange}）` : ''}`;
                if (week === currentWeek) {
                    option.selected = true;
                }
                weekSelect.appendChild(option);
            });
        }

        // 更新当前时间显示（每秒更新）
        function updateCurrentTime() {
            const now = new Date();
            const timeEl = document.getElementById('current-time');
            const dateEl = document.getElementById('current-date');
            
            // 格式化时间（带秒）
            const hours = String(now.getHours()).padStart(2, '0');
            const minutes = String(now.getMinutes()).padStart(2, '0');
            const seconds = String(now.getSeconds()).padStart(2, '0');
            
            // 格式化日期
            const year = now.getFullYear();
            const month = String(now.getMonth() + 1).padStart(2, '0');
            const day = String(now.getDate()).padStart(2, '0');
            const weekDay = getWeekDay(now);
            
            timeEl.textContent = `${hours}:${minutes}:${seconds}`;
            dateEl.textContent = `${year}-${month}-${day}（周${weekDay}）`;
        }

        // 初始化页面
        function initPage() {
            // 初始化周选择器
            initWeekSelector();
            
            // 初始渲染未来7天课程
            renderUpcoming7Days();
            
            // 初始渲染当前周课程
            const currentWeek = getCurrentWeek();
            renderWeekSearchResult(currentWeek);
            
            // 初始渲染当前课程和下一节课
            renderCurrentClass();
            renderNextClass();
            
            // 更新当前时间
            updateCurrentTime();
            
            // 实时更新（每秒）
            setInterval(() => {
                updateCurrentTime();
                renderCurrentClass();
                renderNextClass();
                // 每分钟更新一次未来七天课程
                if (new Date().getSeconds() === 0) {
                    renderUpcoming7Days();
                }
            }, 1000); // 每秒更新一次
            
            // 搜索按钮点击事件
            document.getElementById('search-btn').addEventListener('click', () => {
                const selectedWeek = parseInt(document.getElementById('search-week').value);
                renderWeekSearchResult(selectedWeek);
            });
            
            // 周选择变化事件
            document.getElementById('search-week').addEventListener('change', (e) => {
                const selectedWeek = parseInt(e.target.value);
                renderWeekSearchResult(selectedWeek);
            });
        }

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', initPage);
    </script>
</body>
</html>
